// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import './assets/css/global.css'
Vue.use(ElementUI)
Vue.config.productionTip = false

// v-chart表格
import VCharts from 'v-charts'
Vue.use(VCharts)

// excel
import FileSaver from 'file-saver';
import XLSX from 'xlsx'


// 高德
import VueAMap from 'vue-amap'; 
Vue.use(VueAMap);
VueAMap.initAMapApiLoader({
  key: '34614eed234c39f71b383674d16e05a2',
  plugin: ['AMap.Autocomplete',
            'AMap.PlaceSearch',
            'AMap.Scale',
            'AMap.OverView',
            'AMap.ToolBar',
            'AMap.MapType',
            'AMap.PolyEditor',
            'AMap.CircleEditor'
          ],
  // 默认高德 sdk 版本为 1.4.4
  v: '1.4.4'
});






// 拦截器
var whiteList = ['login', 'register', 'mima']
router.beforeEach((to, from, next) => {
  if (whiteList.indexOf(to.name) > -1 || localStorage.getItem("jwt")) {
    next();
  } else {
    next('/login')
  }
});


/*引入axios*/
import Axios from 'axios'
Vue.prototype.axios = Axios;


require('!style-loader!css-loader!../static/index.css');

import QS from 'qs'
Vue.prototype.qs = QS;

import HeyUI from 'heyui';
Vue.use(HeyUI);

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  render: h => h(App)
})



